// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../components/Home.vue' // 首页组件
import Cart from '../components/Cart.vue' // 购物车组件
import Profile from '../components/Profile.vue' // 我的组件
import Category from '../components/Category.vue'
import Order from '../components/order.vue'
import OrderDetail from '../components/orderdetail.vue' // 订单详情组件
import Product from '../components/Product.vue' // 商品详情组件
import Chat from '../components/Chat.vue'

const routes = [
  { path: '/', component: Home },
  { path: '/cart', component: Cart },
  { path: '/profile', component: Profile },
  { path: '/chat', component: Chat },
  {
    path: '/product/:id',
    name: 'Product',
    component: Product
  },
  {
    path: '/category',
    name: 'Category',
    component: () => import('../components/Category.vue')
  },
  {
    path: '/order',
    name: 'Order',
    component: Order
  },
  {
    path: '/order/:id',
    name: 'OrderDetail',
    component: OrderDetail
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

export default router